package com.ruoyi.common.core.utils.aliyun;

import cn.hutool.core.lang.Dict;
import cn.hutool.http.HttpUtil;
import com.ruoyi.common.core.utils.JsonUtils;
import com.ruoyi.common.core.utils.UrlConfig;
import com.ruoyi.common.core.web.oldUtils.SpringUtils;

public class TranslateImage {

//	private static final UrlConfig urlConfig = SpringUtils.getBean(UrlConfig.class);

	public static Object translateImage(String url) {

		try {
//			System.out.println(urlConfig.getHandle());
			String res = HttpUtil.get("http://120.224.119.46:8890" + "/translate/translateImage?url=" + url);
			Dict parseMap = JsonUtils.parseMap(res);
			String data = (String) parseMap.get("data");
			Dict resDate = JsonUtils.parseMap(data);
			return resDate;
		} catch (Exception e) {
			return "";
		}
	}

    public static String queryFinalImage(String url) {
		try {
			String res = HttpUtil.get("http://120.224.119.46:8890" + "/translate/translateFinalImage?url=" + url);
			Dict parseMap = JsonUtils.parseMap(res);
			String data = (String) parseMap.get("data");
			return data;
		} catch (Exception e) {
			return "";
		}
	}
}
